package config

import (
	concurrent2 "baidu/atomic/concurrent"
	"baidu/params"
	"github.com/gpmgo/gopm/modules/goconfig"
	"time"
)

type FileContent struct {
	FileName string
	Content  string
	I        int
}

func Init(configPath string) {
	params.StartTime = time.Now().Unix()

	cfg, err := goconfig.LoadConfigFile(configPath)
	if err != nil {
		panic(err)
	}

	// 基础参数设置
	basePathP, err := cfg.GetValue("", "basePath")
	if err != nil {
		panic(err)
	}
	AppId, err := cfg.GetValue("", "AppId")
	if err != nil {
		panic(err)
	}
	ApiKey, err := cfg.GetValue("", "ApiKey")
	if err != nil {
		panic(err)
	}
	SecretKey, err := cfg.GetValue("", "SecretKey")
	if err != nil {
		panic(err)
	}
	per, err := cfg.GetValue("", "per")
	if err != nil {
		panic(err)
	}

	params.AppId = AppId
	params.ApiKey = ApiKey
	params.SecretKey = SecretKey
	params.BasePath = basePathP
	params.Per = per
}

var Concurrent concurrent2.Concurrent = concurrent2.Concurrent{}
var ContentCount int = 0
